﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="TypeList.aspx.cs" Inherits="PowerToolsWeb.Admin.TypeList" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>产品类别列表</title>
    <link type="text/css" rel="Stylesheet" href="../Style/admin.css" />
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <div class="DivTitle" style="vertical-align: bottom">
            <table cellpadding="0" cellspacing="0" border="0">
                <tr>
                    <td align="left">
                        <img alt="" src="../Style/admin/tb.gif" width="14" height="14" /><span id="spannal"
                            runat="server">产品类别列表</span>
                    </td>
                </tr>
            </table>
        </div>
        <asp:GridView ID="GridView1" Width="80%" runat="server" AutoGenerateColumns="False"
            CssClass="GridView" DataKeyNames="TypeID" OnRowCommand="GridView1_RowCommand"
            OnRowEditing="GridView1_RowEditing" 
            onrowcancelingedit="GridView1_RowCancelingEdit" 
            onrowupdating="GridView1_RowUpdating" 
            onrowdatabound="GridView1_RowDataBound">
            <Columns>
                <asp:BoundField HeaderText="类别名" DataField="TypeName"></asp:BoundField>
                <asp:BoundField HeaderText="拥有产品数" DataField="productCount" ReadOnly="true"></asp:BoundField>
                <asp:TemplateField>
                    <HeaderTemplate>
                        操 作</HeaderTemplate>
                    <ItemStyle HorizontalAlign="Center" />
                    <EditItemTemplate>
                        <asp:LinkButton ID="LinkButton1" runat="server" CausesValidation="True" CommandName="Update"
                            Text="更新"></asp:LinkButton>
                        &nbsp;&nbsp;|&nbsp;&nbsp;<asp:LinkButton ID="LinkButton2" runat="server" CausesValidation="False" CommandName="Cancel"
                            Text="取消"></asp:LinkButton>
                    </EditItemTemplate>
                    <ItemTemplate>
                        <img src="../Style/admin/edit.gif" width="10" height="10" alt="" />
                        <asp:LinkButton ID="LinkButton1" runat="server" CommandArgument='<%#Eval("TypeID") %>'
                            CommandName="Edit">修改</asp:LinkButton>
                        &nbsp;&nbsp;|&nbsp;&nbsp;<img src="../Style/admin/del.gif" width="10" height="10"
                            alt="" />
                        <asp:LinkButton ID="lbDelete" runat="server" CommandArgument='<%#Eval("TypeID") %>'
                            CommandName="deleteType" OnClientClick="return confirm('你确认删除该类别？');">删除</asp:LinkButton>
                        <span id="spanInDown" runat="server" visible='<%# Eval("ParantTypeID").ToString().Trim()=="0" %>'>
                            &nbsp;&nbsp;|&nbsp;&nbsp;<img src="../Style/admin/add.gif" width="10" height="10"
                                alt="" />
                            <asp:LinkButton ID="lbInDown" runat="server" CommandArgument='<%#Eval("TypeID") %>'
                                CommandName="inDown">进入下级</asp:LinkButton>
                        </span>
                    </ItemTemplate>
                </asp:TemplateField>
            </Columns>
        </asp:GridView>
        <fieldset class="fieldsetcon" style="width: 79%">
            <legend><span id="spanTitle">添加类别</span></legend>&nbsp;
            <asp:TextBox ID="txbTypeName" runat="server" CssClass="textBox"></asp:TextBox>
            &nbsp; &nbsp;
            <%--<asp:Button ID="btnChange" runat="server" Text="修 改" CssClass="button_bg"/>--%>
            <asp:Button ID="btnAdd" runat="server" Text="添 加" CssClass="button_bg2" OnClick="btnAdd_Click" />
        </fieldset>
    </div>
    </form>
</body>

<script type="text/javascript">
    function OpenWindows(pid) {
        var str = window.showModalDialog("TypeEdit.aspx?tid=" + pid, "EDIT", "dialogWidth:300px;dialogHeight:150px");
        if (str == null) {
            return;
        }
        if (str) {
            alert("修改成功");
            window.location.href = window.location.href;
        } else {
            alert("修改失败");
        }

    }
</script>

</html>
